<?php
/**
 * Created by PhpStorm.
 * User: 69568
 * Date: 2018/7/25
 * Time: 0:07
 */

namespace app\admin\controller;


use app\user\model\UserOrderModel;
use cmf\controller\AdminBaseController;

class OrderController extends AdminBaseController
{

    public function index()
    {
        $order_type = $this->request->param('order_type', "");
        $pay_status = $this->request->param('pay_status', "");

        $userModel = new UserOrderModel();
        $where = [];
        if ($pay_status != "") {
            $where['pay_status'] = $pay_status;
        }
        if ($order_type != "") {
            $where['type'] = $order_type;

        }
        $orders = $userModel->with('user')->where($where)->paginate(10);
        $page = $orders->render();
        $this->assign('orders', $orders);
        $this->assign('page', $page);
        $this->assign('order_type',$order_type);
        $this->assign('pay_status',$pay_status);

        return $this->fetch();
    }
}